﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NTypeClasses.PrimitiveTypes
{
	/// <summary>
	/// Extends primitive types with some arithmetics.
	/// </summary>
	[TypeExtension]
	public static class Arithmetics
	{
		#region Double
		
		#region Ring
		/// <summary>
		/// Provides operator+ for System.Double
		/// </summary>
		/// <param name="a">Left argument.</param>
		/// <param name="b">Right argument.</param>
		/// <returns>a + b</returns>
		public static double op_Addition(double a, double b)
		{
			return a + b;
		}
		/// <summary>
		/// Provides operator- for System.Double
		/// </summary>
		/// <param name="a">Left argument.</param>
		/// <param name="b">Right argument.</param>
		/// <returns>a - b</returns>
		public static double op_Subtraction(double a, double b)
		{
			return a - b;
		}
		/// <summary>
		/// Provides operator* for System.Double
		/// </summary>
		/// <param name="a">Left argument.</param>
		/// <param name="b">Right argument.</param>
		/// <returns>a * b</returns>
		public static double op_Multiply(double a, double b)
		{
			return a * b;
		}
		/// <summary>
		/// Provides static property Zero for System.Double
		/// </summary>
		public static double Zero { get { return 0; } }
		/// <summary>
		/// Provides unary negation operator- for System.Double
		/// </summary>
		/// <param name="value">A value to be negated.</param>
		/// <returns>-value</returns>
		public static double op_UnaryNegation(double value) { return -value; }
		/// <summary>
		/// Provides operator== for System.Double
		/// </summary>
		/// <param name="a">Left argument.</param>
		/// <param name="b">Right argument.</param>
		/// <returns>true if a == b, else false</returns>
		public static bool op_Equality(double a, double b)
		{
			return a == b;
		}
		#endregion

		#region Field
		/// <summary>
		/// Provides static property One for System.Double
		/// </summary>
		public static double One { get { return 1; } }
		/// <summary>
		/// Provides operator/ for System.Double
		/// </summary>
		/// <param name="a">Left argument.</param>
		/// <param name="b">Right argument.</param>
		/// <returns>a / b</returns>
		public static double op_Division(double a, double b) { return a / b; }
		#endregion

		#endregion
	}
}
